FROM ubuntu:24.04
RUN sed -i 's|archive.ubuntu.com|mirrors.huaweicloud.com|g' /etc/apt/sources.list

# 1. 更换 APT 源为阿里云镜像
#RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list \
#    && sed -i 's/security.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN:zh
RUN apt-get update && apt-get install -y \
    curl \
    wget \
    locales \
    openjdk-17-jdk && \
    locale-gen zh_CN.UTF-8 && \
    update-locale LANG=zh_CN.UTF-8


#FROM registry.cn-hangzhou.aliyuncs.com/dockerhub_mirror/java:21-anolis

MAINTAINER jeecgos@163.com

RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

#RUN mkdir -p /jeecg-boot/config/jeecg/

WORKDIR /jeecg-boot

EXPOSE 3103
# 使用官方脚本安装阿里云CLI
RUN /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)"

# 4. 验证安装
RUN aliyun --version
# 配置 CLI 认证（构建时自动完成）
ARG ALIYUN_ACCESS_KEY
ARG ALIYUN_SECRET_KEY

RUN aliyun configure set \
  --profile default \
  --mode AK \
  --region cn-hangzhou \
  --access-key-id $ALIYUN_ACCESS_KEY \
  --access-key-secret $ALIYUN_SECRET_KEY
#ADD ./src/main/resources/jeecg ./config/jeecg
ADD ./target/jeecg-system-start-3.8.0.jar ./

CMD sleep 60;java -Djava.security.egd=file:/dev/./urandom -jar jeecg-system-start-3.8.0.jar

